#if !defined(AFX_INCLUSIONDLG_H__1577B3BD_F3DB_4250_B2D8_AFF205FEFDAE__INCLUDED_)
#define AFX_INCLUSIONDLG_H__1577B3BD_F3DB_4250_B2D8_AFF205FEFDAE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ExclusionST.h"
#include "ListCtrlEdit.h"
#include "NumEdit.h"
#include "NumSpinCtrl.h"
#include "ResizingDialog.h"
#include "afxwin.h"
#include "gp_uv_rc.h"

// InclusionDlg.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CInclusionDlg dialog

namespace nsInclusionDlg {

struct SCURSORS {
	HCURSOR	hStd,
			hSize[ nsExclusionStatic::ecNone ];
};

enum EBUTTONMODE {
	ebmDraw,
	ebmSelect,
	ebmNone
};

enum EUNIT {
	eunNone,
	eunPixel,
	eunCm,
	eunInch,
};

struct SLC_COLUMNS {
	int iColWidth;
	TCHAR *pszColHeader;
};

struct SLC_SPIN_VALUES {
	double dDelta,
		   dLowerX, dUpperX,
		   dLowerY, dUpperY;
};

struct SINCDLG_SIZE {
	int x, 
		y, 
		nWidth, 
		nHeight, 
		nLeftHalf, 
		nTopHalf;
};

}; // namespace

class CInclusionDlg : public CResizingDialog
{
// Construction
public:
	CInclusionDlg(CWnd* pParent = NULL);   // standard constructor

	BOOL	Create();
	void	SetImageRes( int iWidth, int iHeight, int iDPI );

// Dialog Data
	//{{AFX_DATA(CInclusionDlg)
	enum { IDD = IDD_DLG_INCLUSION };
	CNumSpinCtrl	m_spTop;
	CNumSpinCtrl	m_spRight;
	CNumSpinCtrl	m_spLeft;
	CNumSpinCtrl	m_spBottom;
	CNumEdit	m_efTop;
	CNumEdit	m_efRight;
	CNumEdit	m_efLeft;
	CNumEdit	m_efBottom;
	CExclusionST	m_picExclusion;
	CListCtrlEdit	m_lcAreas;
	int		m_rgUnits;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CInclusionDlg)
	public:
	virtual BOOL DestroyWindow();
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

//	void SetLayoutRes( int iPixelsX, int iPixelsY, int iDPI );

// Implementation
private:
	nsExclusionStatic::SLAYOUTBITMAP m_LayoutBitmap;
//	vector <SEXCLUSION> m_vExclusionList;
	nsInclusionDlg::EBUTTONMODE m_Mode;
//	CPoint	m_pntStart;
	CPoint	m_pntLButtonDown;
	CRect	m_rectPic;
	double	m_dUnitFactor;
	nsInclusionDlg::EUNIT	m_Unit;
//	SSYSTEMMETRICS m_SystemMetrics;
	nsInclusionDlg::SCURSORS m_Cursor;
	nsInclusionDlg::SINCDLG_SIZE m_DlgSize;
	bool	m_bRestorePos;
	int		m_iImageX, 
			m_iImageY,
			m_iDPI;

	void	SetupListView();

	void	SetSpinValues( nsInclusionDlg::SLC_SPIN_VALUES *pSpVal );
	void	SetBuddies();
	nsInclusionDlg::EUNIT	UpdateUnitFactor();
	void	GetFormattedCoordinate( CString &str, int iPixel );
	void	UpdateFields();
	void	UpdateList();
//	void	Screen2Client( CPoint *pPoint );
	void	TranslatePoint( CPoint *pPointDst, CPoint *pPointSrc );
	double  Round( double dVal, int iDigits );

	bool	SelectArea( CPoint *pPoint );
	void	MoveSelection( WPARAM Key, bool bShift );

/*
	HBITMAP	CreateLayoutBitmap( int iPixelsX, int iPixelsY, int iBitCount );
	void	DrawBitmap( CDC *pDC, HBITMAP hBitmap, HPALETTE hPal, int xDest, int yDest );
	void	RedrawLayout( HBITMAP hBmp );
	void	DrawExclusion( CDC *pDC );
*/
	
protected:
//	CWnd* m_pParent;
//	int m_nID;

	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CInclusionDlg)
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	virtual BOOL OnInitDialog();
	afx_msg void OnRgUnits();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
/*
	virtual void OnOK();
	virtual void OnCancel();
*/
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnClickLvAreas(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_INCLUSIONDLG_H__1577B3BD_F3DB_4250_B2D8_AFF205FEFDAE__INCLUDED_)
